<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<form action="users/edit">
    <input type="hidden" name="id" value="${requestScope.users.id}">
    <div class="form-group">
        <label for="roleName">所属角色</label>
        <select id="roleName" name="role.id" data-id="${users.role.id}" class="form-control">
            <c:forEach items="${requestScope.roles}" var="role">
                <option value="${role.id}">${role.name}</option>
            </c:forEach>
        </select>
        <script>
            $(function () {
                $('#roleName').val($('#roleName').attr('data-id'));
            })
        </script>
    </div>

</form>
